home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / elements / CheckButton < prev    next >
Encoding:
Text File  |  1993-11-20  |  6.4 KB  |  188 lines

  1. # Program: xf
  2. # Description: handle checkbutton widgets
  3. #
  4. # $Header: CheckButton[2.3] Wed Mar 10 11:58:40 1993 garfield@garfield frozen $
  5.  
  6. global xfDefaultConf
  7. set xfDefaultConf(checkbutton) 4
  8.  
  9. ##########
  10. # Procedure: XFAdd.CheckButton
  11. # Description: add a checkbutton
  12. # Arguments: xfW - the widget
  13. #            xfName - a optional name
  14. #            xfType - add or config
  15. # Returns: none
  16. # Sideeffects: none
  17. ##########
  18. proc XFAdd.CheckButton {xfW xfName xfType} {
  19.   global xfStatus
  20.  
  21.   XFEditSetStatus "Inserting CheckButton..."
  22.   set xfName [XFMiscGetUniqueName $xfName checkbutton]
  23.   if {"$xfStatus(path)" == "."} {
  24.     if {"$xfType" == "add"} {
  25.       checkbutton .$xfName \
  26.         -text "$xfName" \
  27.         -relief raised
  28.     } {
  29.       checkbutton .$xfName
  30.     }
  31.  
  32.     XFMiscPositionWidget .$xfName
  33.     XFMiscBindWidgetTree .$xfName
  34.   } {
  35.     if {"$xfType" == "add"} {
  36.       checkbutton $xfStatus(path).$xfName \
  37.         -text "$xfName" \
  38.         -relief raised
  39.     } {
  40.       checkbutton $xfStatus(path).$xfName
  41.     }
  42.  
  43.     XFMiscPositionWidget $xfStatus(path).$xfName
  44.     XFMiscBindWidgetTree $xfStatus(path).$xfName
  45.   }
  46.  
  47.   incr xfStatus(elementCounter)
  48.   XFEditSetPath $xfStatus(path)
  49.   XFEditSetStatus "Inserting CheckButton...done"
  50. }
  51.  
  52. ##########
  53. # Procedure: XFConfig.CheckButton4
  54. # Description: configure a checkbutton
  55. # Arguments: xfW - the widget
  56. #            xfType - config type (add config)
  57. #            xfClass - the class we configure
  58. #            xfLeader - the leading window
  59. # Returns: none
  60. # Sideeffects: none
  61. ##########
  62. proc XFConfig.CheckButton4 {xfW xfType xfClass {xfLeader ""}} {
  63.   global xfConf
  64.   global xfStatus
  65.  
  66.   if {"$xfType" == "add"} {
  67.     set xfName checkbutton$xfStatus(elementCounter)
  68.   } {
  69.     set xfName [XFMiscPathName $xfW]
  70.   }
  71.   XFEditSetStatus "Calling parameter setting for Checkbutton..."
  72.  
  73.   # build widget structure
  74.   XFTmpltToplevel .xf${xfClass}Config4 400x540 \
  75.     "Checkbutton parameters:[XFMiscPathTail $xfW]" $xfLeader
  76.  
  77.   XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
  78.     XFCheckButtonSetCheckButton4 parameters $xfName 4
  79.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
  80.     background Background "Background" XFCheckButtonSetCheckButton4
  81.   XFElementBitmap $xfW .xf${xfClass}Config4 $xfType $xfClass \
  82.     XFCheckButtonSetCheckButton4
  83.   XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass font \
  84.     font Font "Font" XFCheckButtonSetCheckButton4
  85.   if {$xfConf(kanji)} {
  86.     XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass kanjifont \
  87.       kanjiFont KanjiFont "Kanji font" XFCheckButtonSetCheckButton4
  88.   }
  89.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass fg \
  90.     foreground Foreground "Foreground" XFCheckButtonSetCheckButton4
  91.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass text text Text \
  92.     "Label" XFCheckButtonSetCheckButton4 $xfName
  93.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass offvalue \
  94.     offValue Value "Off value" XFCheckButtonSetCheckButton4 0
  95.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass onvalue \
  96.     onValue Value "On value" XFCheckButtonSetCheckButton4 1
  97.   XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass \
  98.     XFCheckButtonSetCheckButton4
  99.   XFElementTextVariable $xfW .xf${xfClass}Config4 $xfType $xfClass \
  100.     XFCheckButtonSetCheckButton4
  101.   XFElementVariable $xfW .xf${xfClass}Config4 $xfType $xfClass \
  102.     XFCheckButtonSetCheckButton4 
  103.   XFElementCommand $xfW .xf${xfClass}Config4 $xfType
  104.  
  105.   if {"$xfType" == "add"} {
  106.     .xf${xfClass}Config4.params1.params2.variable.variable delete 0 end
  107.     .xf${xfClass}Config4.params1.params2.variable.variable insert 0 $xfName
  108.   }
  109.  
  110.   # save current parameter
  111.   if {$xfConf(kanji)} {
  112.     XFElementSave $xfW $xfClass {background bitmap command font kanjifont foreground height offvalue onvalue text textvariable variable width}
  113.   } {
  114.     XFElementSave $xfW $xfClass {background bitmap command font foreground height offvalue onvalue text textvariable variable width}
  115.   }
  116.  
  117.   # packing
  118.   pack append .xf${xfClass}Config4.params1 \
  119.               .xf${xfClass}Config4.params1.params2 {left fill expand}
  120.   pack append .xf${xfClass}Config4 \
  121.               .xf${xfClass}Config4.pathname {top fill frame center} \
  122.               .xf${xfClass}Config4.leave {bottom fill} \
  123.               .xf${xfClass}Config4.additional {bottom fill} \
  124.               .xf${xfClass}Config4.params1 {top fill expand}
  125.  
  126.   XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
  127.     "XFCheckButtonSetCheckButton4 $xfW 0 $xfClass"
  128.  
  129.   XFEditSetStatus "Calling parameter setting for CheckButton...done"
  130. }
  131.  
  132. ##########
  133. # Procedure: XFCheckButtonSetCheckButton4
  134. # Description: set checkbutton parameters
  135. # Arguments: xfW - the widget
  136. #            xfType - the type of setting (1 = set always, 0 = set
  137. #                     only if permanent apply is on)
  138. #            xfClass - the class we configure
  139. #            xfParam1 - ignored parameter
  140. # Returns: none
  141. # Sideeffects: none
  142. ##########
  143. proc XFCheckButtonSetCheckButton4 {xfW xfType xfClass {xfParam1 ""}} {
  144.   global xfConf
  145.   global xfMisc
  146.  
  147.   if {$xfType == 0 && !$xfConf(applyParameters)} {
  148.     return
  149.   }
  150.   if {"[info commands $xfW]" == ""} {
  151.     return
  152.   }
  153.   XFMiscSetSymbolicName $xfW \
  154.     [.xf${xfClass}Config4.params1.params2.symname.symname get]
  155.  
  156.   XFMiscSetResource $xfW background \
  157.     [.xf${xfClass}Config4.params1.params2.bg.bg get]
  158.   XFMiscSetResource $xfW bitmap \
  159.     [.xf${xfClass}Config4.params1.params2.bitmap.bitmap get]
  160.   XFMiscSetResource $xfW command \
  161.     [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
  162.   XFMiscSetResource $xfW font \
  163.     [.xf${xfClass}Config4.params1.params2.font.font get]
  164.   if {$xfConf(kanji)} {
  165.     XFMiscSetResource $xfW kanjifont \
  166.       [.xf${xfClass}Config4.params1.params2.kanjifont.kanjifont get]
  167.   }
  168.   XFMiscSetResource $xfW foreground \
  169.     [.xf${xfClass}Config4.params1.params2.fg.fg get]
  170.   XFMiscSetResource $xfW height \
  171.     [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
  172.   XFMiscSetResource $xfW offvalue \
  173.     [.xf${xfClass}Config4.params1.params2.offvalue.offvalue get]
  174.   XFMiscSetResource $xfW onvalue \
  175.     [.xf${xfClass}Config4.params1.params2.onvalue.onvalue get]
  176.   XFMiscSetResource $xfW text \
  177.     [.xf${xfClass}Config4.params1.params2.text.text get]
  178.   XFMiscSetResource $xfW textvariable \
  179.     [.xf${xfClass}Config4.params1.params2.textvar.textvar get]
  180.   XFMiscSetResource $xfW variable \
  181.     [.xf${xfClass}Config4.params1.params2.variable.variable get]
  182.   XFMiscSetResource $xfW width \
  183.     [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
  184. }
  185.  
  186. # eof
  187.  
  188.